<template>
	<view>
		<view class="order-content">
			<view style="margin-bottom: 40rpx;">
				<view class="detail-title">
					<text>完成信息</text>
				</view>
				<!-- <view class="detail-item">
					<text class="left">任务名称：</text>
					<view class="right-content">{{taskDetail['任务名称']}}</view>
				</view> -->
				<view class="content-item">
					<text class="item-name">巡查项：</text>
					<view class="right-content">{{ pointInfo['检查项名字'] }}</view>
				</view>
				<view class="content-item">
					<text class="item-name">完成时间：</text>
					<view class="right-content">{{ pointInfo['完成时间'] | formatTime }}</view>
				</view>
				<view class="content-item">
					<text class="item-name">完成描述：</text>
					<view class="right-content">{{ pointInfo['完成描述'] }}</view>
				</view>
				<file-list v-if="pointInfo['附件']" title="完成附件" :idList="pointInfo['附件']" :fileObj="completeFile" :length="imgLength"></file-list>
			</view>
			<!-- <view style="margin-bottom: 40rpx;">
				<view class="detail-title">
					<text>完成信息</text>
				</view>
				<view class="content-item">
					<text class="item-name">经度：</text>
					<view class="right-content">{{pointInfo['定位经度'] }}</view>
				</view>
				<view class="content-item">
					<text class="item-name">纬度：</text>
					<view>{{ pointInfo['定位维度'] }}</view>
				</view>
				<view class="content-item">
					<text class="item-name">距离巡逻点：</text>
					<view class="right-content">{{ pointInfo['定位距离'] + '米' }}</view>
				</view>
				<file-list v-if="pointInfo['附件']" title="完成附件" :idList="pointInfo['附件']" :fileObj="completeFile" :length="imgLength"></file-list>
			</view> -->
		</view>
	</view>
</template>

<script>
	import FileList from '@/components/my-components/fileList'
	export default {
		components: {
			FileList
		},
		data() {
			return {
				infoList: ['巡逻信息', '巡逻点', '巡逻人', '巡逻时间'],
				imgLength: 0,
				imgItem: [],
				pointInfo: {},
				completeFile: {},
				params: {
					id: null
				}
			}
		},
		onLoad(options) {
			this.params.id = +JSON.parse(options.item).任务记录id
			this.getInspectDetail()
			console.log('传参',JSON.parse(options.item))
			this.pointInfo = JSON.parse(options.item)
			if(this.pointInfo.附件) {
				this.pointInfo.附件.forEach((item, index) => {
					this.downloadFile(item, index)
				})
			}
			console.log(this.pointInfo)
			// this.getPointInfo()
		},
		methods: {
			getInspectDetail() {
				this.$http.post('taskSystem/task/patrolPoint/info',this.params).then(res => {
						console.log('详情', res)
				})
			},
			downloadFile(id, index) {
				this.imgLength++
				this.$http.post('common/file/download', {
					id
				}).then(res => {
					console.log(res)
					if (res.code === 10000) {
						this.imgItem.push(res.data.fileData)
						this.completeFile[index] = {}
						this.completeFile[index].fileData = res.data.fileData
						// console.log(this.ticketFile)
					}
				})
			},
		}
	}
</script>

<style lang="scss">
.order-content {
		margin-bottom: 40rpx;
		width: 750rpx;
		background-color: #fff;
		margin-bottom: 135rpx;
		padding-left: 49rpx;
		padding-top: 30rpx;
		.detail-title {
			position: relative;
			font-size: 36rpx;
			padding-left: 10rpx;
			margin-left: -24rpx;
			margin-bottom: 20rpx;
			display: flex;
			justify-content: space-between;
			&:before {
				position: absolute;
				content: '';
				width: 6rpx;
				height: 38rpx;
				left: -6rpx;
				top: 6rpx;
				background-color: #1064E9;;
			}
			// padding-right: 30rpx;
			.operator-btn {
				position: absolute;
				right: 40rpx;
				width: 100rpx;
				height: 50rpx;
				line-height: 50rpx;
				text-align: center;
				font-size: 28rpx;
				border-radius: 10rpx;
				background-color: #1152FC;
				color: #fff;
			}
		}
		.content-item {
			// height: 72rpx;
			padding: 20rpx 20rpx 20rpx 0;
			display: flex;
			align-items: center;
			font-size: 32rpx;
			view {
				font-size: 32rpx;
			}
			.item-name {
				width: 250rpx;
				margin-right: 20rpx;
			}
			.right-content {
				flex: 1;
				word-break: break-all;
				padding-right: 30rpx;
			}
		}
		.detail-item {
			width: 750rpx;
			height: 88rpx;
			display: flex;
			line-height: 88rpx;
			// padding-left: 20rpx;
			background-color: #fff;
			border-bottom: 2rpx solid #f5f5f5;

			.left {
				margin-right: 37rpx;
			}
			.name {
				margin-right: 26rpx;
			}
		}
	}
</style>
